/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uit.ieproject.utilites;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 *
 * @author Maivia
 */
public class BackgroundPanel extends JPanel {

    Image image;

    public BackgroundPanel(String url) {
        try {
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(url));
            Image image = icon.getImage();
            this.image = image;
        } catch (Exception e) { 
        }
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (image != null) {
            g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), this);
        }
    }
}
